'''
订单类：需求方，功能使用方。
'''
import abstractFactory


class Order(object):
    '''
    创建订单
    '''
    @staticmethod
    def orderPizza(pizzaFactory, pizza_type):
        pizza = pizzaFactory().createPizza(pizza_type)
        if pizza is None:
            print("====>> 找不到对应的pizza类型！")
            return
        
        pizza.parpare()
        pizza.bake()
        pizza.pack()


if __name__ == "__main__":
    location_type = input("请输入pizza产地：")
    factory_name = '%sFactory' % location_type.upper()
    if not hasattr(abstractFactory, factory_name):
        print("====>> 产地不存在！")
    else:
        pizza_type = input("请输入pizza种类：")
        pizzaFactory = getattr(abstractFactory, factory_name)
        Order.orderPizza(pizzaFactory, pizza_type)
